<div class="da-list-wrap">
  <div class="da-content-banner">
    <d-breadcrumb>
      <d-breadcrumb-item><a routerLink="/">{{ 'basicdata.breadcrumb.home' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item>供应商价格表</d-breadcrumb-item>
    </d-breadcrumb>
  </div>
  <div class="da-content-wrapper">
    <div class="departments">
      <div class="card">
        <div class="card-title">
          <span>供应商</span>
        </div>
        <div class="fitter mt-3">
          <input dTextInput placeholder="请输入" name="searchValue" (input)="searchClass($event)" />
        </div>
        <div class="card-body ">
          <d-tree #basicTree [tree]="displayTreeData" [treeNodeIdKey]="'supplyId'"
            [treeNodeTitleKey]="'supplyChineseName'" (afterTreeInit)="afterTreeInit($event)"
            (nodeSelected)="nodeSelected($event)">
          </d-tree>
        </div>
        <div class="card-footer d-flex  align-items-bottom justify-content-center">
        </div>
      </div>
    </div>
    <div class="employs-box">
      <d-splitter orientation="vertical" disabledBarSize="1px" [splitBarSize]="splitBarSize" style="height: 100%">
        <d-splitter-pane minSize="50%" [size]="partDetailHeight">
          <div class="card">
            <div class="card-header">
              <div class="d-input">
                <div class="inputIn">
                  <input dTextInput style="width: 180px;" [error]="false" placeholder="价格表编号/名称"
                    [(ngModel)]="filter2.SearchTerm" name="SearchTerm">
                  <d-select style="width: 180px;" [options]="statusoptions" [(ngModel)]="filter2.SearchStatus"
                    placeholder="状态"></d-select>
                </div>
                <div class="d-submit">
                  <d-button id="primaryBtn" style="margin-left: 8px" (click)="search2()"><i
                      class="icon icon-filter-o me-2"></i>查询</d-button>
                  <d-button bsStyle="common" (btnClick)=" reset()"> <i class="icon icon-refresh me-2"></i>重置</d-button>
                </div>
              </div>
            </div>
            <div class="btn-group">
              <d-button bsStyle="primary" (btnClick)="addSupplier()"> <i class="icon icon-add me-2"></i>新增</d-button>
              <d-button bsStyle="common"  (btnClick)="Approval(this.checkedIds)">审核</d-button>
              <d-button bsStyle="common"  (btnClick)="reverseApprove(this.checkedIds)">反审核</d-button>
              <!-- <div dDropDown style="display: inline-block;" [trigger]="'hover'" >
              <d-button-group>
                <d-button bsStyle="common" dDropDownToggle ><span class="me-2">审核</span><span
                    class="icon-chevron-down-2 "></span></d-button>
              </d-button-group>
              <ul dDropDownMenu class="devui-dropdown-menu" role="menu">
                <li role="menuitem" (click)="disApproval(this.checkedIds)">
                  <a dDropDownMenuItem>审核不通过</a>
                </li>
                <li role="menuitem">
                  <a dDropDownMenuItem (click)="reverseApprove()"></a>
                </li>
              </ul>
            </div> -->
              <d-button bsStyle="danger" (btnClick)="deleteSupplier()"><i
                  class="icon icon-delete me-2"></i>删除</d-button>
              <div class="dDropDown" dDropDown [trigger]="'hover'">
                <input type="file" #fileInput style="display: none" (change)="onFileSelected($event)">
                <d-button bsStyle="common" class="devui-dropdown-origin" (btnClick)="onButtonClick()">
                  导入
                  <span class="icon-select-arrow"></span>
                </d-button>
                <ul dDropDownMenu class="devui-dropdown-menu devui-scrollbar" role="menu">
                  <li role="menuitem" (click)="DownloadSupplierFileModel()">
                    <a dDropDownMenuItem>下载模板</a>
                  </li>
                </ul>
              </div>
              <d-button bsStyle="common" (btnClick)="DownloadSupplierFile()"><i
                  class="icon-copy-new me-2"></i>导出</d-button>
            </div>
            <div class="list-content">
              <d-data-table [lazy]="true" [dataSource]="tabledata" [scrollable]="true" [fixHeader]="true"
                [tableWidthConfig]="tableWidthConfig" (checkAllChange)="getCheckedRows()"
                (rowCheckChange)="getCheckedRows()" [tableOverflowType]="'auto'" [resizeable]="true"
                [colDraggable]="true">
                <thead dTableHead [checkable]="true">
                  <tr dTableRow>
                    <th dHeadCell [fixedLeft]="'40px'">
                      操作
                    </th>
                    <th dHeadCell [fixedLeft]="colOption.fixedLeft " *ngFor="let colOption of dataTableOptions.columns">
                      {{colOption.header}}
                    </th>
                  </tr>
                </thead>
                <tbody dTableBody>
                  <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
                    <tr dTableRow (click)="showDetail(rowItem)">
                      <td dTableCell [fixedLeft]="'0px'">
                        <d-checkbox [disabled]="false" [showAnimation]="true" [showGlowStyle]="false"
                          [ngModelOptions]="{ standalone: true }" [ngModel]="rowItem.$checked" dTooltip
                          (ngModelChange)="onRowCheckChange($event, rowIndex, nestedIndex, rowItem)">
                        </d-checkbox>
                      </td>
                      <td dTableCell [fixedLeft]="'40px'">
                        <span class="me-2" (click)="editSupplier(rowItem.purchasePriceScheduleId)"><a class="devui-link">编辑</a></span>
                        <span class="me-2" (click)="deleteSupplier(rowItem.purchasePriceScheduleId)"><a
                            class="devui-link-danger">删除</a></span>
                      </td>
                      <td dTableCell [rowItem]="rowItem" [fixedLeft]="'150px'">
                        <span dTooltip [content]="rowItem?.purchasePriceScheduleNum">{{rowItem?.purchasePriceScheduleNum}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem" [fixedLeft]="'300px'">
                        <span dTooltip [content]="rowItem?.scheduleName">{{rowItem?.scheduleName}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem" >
                        <span dTooltip [content]="rowItem?.supplyNum">{{rowItem?.supplyNum}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem">
                        <span dTooltip [content]="rowItem?.supplyName">{{rowItem?.supplyName}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem">
                        <span dTooltip [content]="rowItem?.supplyShortName">{{rowItem?.supplyShortName}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem" [field]="'showType'">
                        <span dTooltip [content]="rowItem?.status"><d-tag [tag]=" rowItem?.status " [labelStyle]="rowItem?.status"></d-tag></span>
                      </td>
                      <td dTableCell [rowItem]="rowItem">
                        <span dTooltip [content]="rowItem?.remark">{{rowItem?.remark}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem">
                        <span dTooltip [content]="rowItem?.createDate | date :'yyyy-MM-dd'">{{rowItem?.createDate | date :'yyyy-MM-dd'}}</span>
                      </td>
                      <td dTableCell [rowItem]="rowItem">
                        <span dTooltip [content]="rowItem?.creator">{{rowItem?.creator}}</span>
                      </td>
                    </tr>
                  </ng-template>
                </tbody>
              </d-data-table>
            </div>
            <div class="page-footer">
              <div>
                <p>已选 <span class="underline">{{checkedIds.length}}</span> 条
                  <a (click)="cleared()" class="clear">清空</a>
                </p>
              </div>
              <d-pagination [size]="'sm'" [canViewTotal]="true" [canChangePageSize]="true" [canJumpPage]="true"
                [maxItems]="5" [total]="this.pager.total" [pageSizeOptions]="this.pageSizeOptions"
                [(pageSize)]="filter.PageSize" [(pageIndex)]="filter.PageNumber" (pageIndexChange)="pageIndexChange()"
                (pageSizeChange)="pageSizeChange()">
              </d-pagination>
            </div>
          </div>
        </d-splitter-pane>
        <d-splitter-pane  class="detailTable" style="overflow: hidden;" >
          <div class="card">
            <div class="list-content">
              <d-data-table [lazy]="true" [dataSource]="partDetail" [scrollable]="true" [fixHeader]="true"
              [tableWidthConfig]="tableWidthConfig2" [tableOverflowType]="'auto'" [resizeable]="true"
              [colDraggable]="true">
              <thead dTableHead>
                <tr dTableRow>
                  <th dHeadCell *ngFor="let colOption of dataTableOptions2.columns">{{
                    colOption.header }}</th>
                </tr>
              </thead>
              <tbody dTableBody>
                <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
                  <tr dTableRow >
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.partNum">{{rowItem?.partNum}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.partName">{{rowItem?.partName}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.partType">{{rowItem?.partType}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.partUOM">{{rowItem?.partUOM}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.partName">{{rowItem?.price}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.isValid | booleanToText:'价格有效':'价格失效'">
                        <d-tag [tag]=" rowItem?.isValid | booleanToText:'价格有效':'价格失效'" [labelStyle]="rowItem?.isValid"></d-tag>
                      </span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.startDate | date :'yyyy-MM-dd'">{{rowItem?.startDate | date :'yyyy-MM-dd'}}</span>
                    </td>
                    <td dTableCell [rowItem]="rowItem">
                      <span dTooltip [content]="rowItem?.endDate | date :'yyyy-MM-dd'">{{rowItem?.endDate | date :'yyyy-MM-dd'}}</span>
                    </td>
                  </tr>
                </ng-template>
              </tbody>
            </d-data-table>
            </div>

          </div>
        </d-splitter-pane>
      </d-splitter>

    </div>
  </div>
</div>
<d-toast [value]="msgs" [life]="2000" [styleClass]="'custom-class'" [style]="{ left: '50%',top:'10px' }"></d-toast>
